'use strict'
  class FinanceService {
    constructor(rpc_client) {
      this.rpc_client = rpc_client
    }
    /**
    * 查询商户余额,返回可用余额和总余额
    * @params shopId 饿了么店铺id
    * @return
    */
    queryBalance(shopId) {
      return this.rpc_client.request("eleme.finance.queryBalance", {
        shopId: shopId,
      })
    }
    /**
    * 查询余额流水,有流水改动的交易
    * @params request 查询条件
    * @return
    */
    queryBalanceLog(request) {
      return this.rpc_client.request("eleme.finance.queryBalanceLog", {
        request: request,
      })
    }
    /**
    * 查询总店账单
    * @params shopId 饿了么总店店铺id
    * @params query 查询条件
    * @return
    */
    queryHeadBills(shopId, query) {
      return this.rpc_client.request("eleme.finance.queryHeadBills", {
        shopId: shopId,
        query: query,
      })
    }
    /**
    * 查询总店订单
    * @params shopId 饿了么总店店铺id
    * @params query 查询条件
    * @return
    */
    queryHeadOrders(shopId, query) {
      return this.rpc_client.request("eleme.finance.queryHeadOrders", {
        shopId: shopId,
        query: query,
      })
    }
    /**
    * 查询分店账单
    * @params shopId 饿了么分店店铺id
    * @params query 查询条件
    * @return
    */
    queryBranchBills(shopId, query) {
      return this.rpc_client.request("eleme.finance.queryBranchBills", {
        shopId: shopId,
        query: query,
      })
    }
    /**
    * 查询分店订单
    * @params shopId 饿了么分店店铺id
    * @params query 查询条件
    * @return
    */
    queryBranchOrders(shopId, query) {
      return this.rpc_client.request("eleme.finance.queryBranchOrders", {
        shopId: shopId,
        query: query,
      })
    }
    /**
    * 查询订单
    * @params shopId 饿了么店铺id
    * @params orderId 订单id
    * @return
    */
    getOrder(shopId, orderId) {
      return this.rpc_client.request("eleme.finance.getOrder", {
        shopId: shopId,
        orderId: orderId,
      })
    }
}

module.exports = FinanceService